﻿/*从页面获取的数据*/
var imghostname = $("#hidden_imghostname").val();
var nav_slide_column_count = $("#hidden_nav_slide_column_count").val();
var nav_slide_rom_count = $("#hidden_nav_slide_rom_count").val();
var nav_slide_change_time = $("#hidden_nav_slide_change_time").val();

/*全局同用的方法*/
//给相对路径加上图片域名
function ImageAddHostName(img) {
    return imghostname + img;
}


$(document).ready(function () {
    var $win = $(window);
    var $nav_bg = $("#main_nav_bg");
    var $nav_menu = $("#main_nav_menu");
    $(window).resize(function () {
        var left_nav_bg = ($win.width() - $nav_bg.width()) / 2;
        var left_nav_menu = ($win.width() - $nav_menu.width()) / 2;

        left_nav_menu = left_nav_menu < 0 ? 0 : left_nav_menu;

        $nav_bg.css("margin-left", left_nav_bg + "px");
        $nav_menu.css("left", left_nav_menu + "px");
    });
    $nav_bg.amingslide({
        imglist: [
            ImageAddHostName("/images/1.png"),
            ImageAddHostName("/images/2.png"),
            ImageAddHostName("/images/3.png")],
        column_count: nav_slide_column_count,
        rom_count: nav_slide_rom_count,
        change_time: nav_slide_change_time
    });

    $nav_bg.css("opacity", "0.6");
    $(window).trigger("resize");
});